DevForce Help Reference
GetterInterceptor Property (NavigationScalarEntityProperty<TInstance,TValue>)
Example 


The getter PropertyInterceptor.
Syntax
Remarks
Use the GetterInterceptor to add custom BeforeGet and AfterGet interception actions to a property getter.
Example
public void Sample() {

  // Add a BeforeGet action to a GetterInterceptor:
  Employee.PropertyMetadata.DirectReports.GetterInterceptor.AddAction(
    PropertyInterceptorTiming.Before,
    TraceGetter);

  // Add a BeforeSet action to a SetterInterceptor (a SetterInterceptor is available
  // only for scalar and non-readonly navigation properties).
  Employee.PropertyMetadata..Manager.SetterInterceptor.AddAction(
    PropertyInterceptorTiming.Before,
    TraceSetter);

  // Get/set a few properties
  DomainModelEntityManager mgr = new DomainModelEntityManager();
  Employee e = mgr.Employees.First();
  e.Manager = null;         
  var list = e.DirectReports;
}

public static void TraceGetter(IEntityPropertyGetInterceptorArgs args) {
  Console.WriteLine("getter called for " + args.EntityProperty.Name);
}

public static void TraceSetter(IEntityPropertySetInterceptorArgs args) {
  Console.WriteLine("setter called for " + args.EntityProperty.Name);
}
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

NavigationScalarEntityProperty<TInstance,TValue> Class
NavigationScalarEntityProperty<TInstance,TValue> Members

Send Feedback